#include <stdio.h>
#include <stdlib.h>
#include <string.h>


char** findRelativeRanks(int* score, int scoreSize, int* returnSize)
{
    char **ptr = malloc(sizeof(char*)*scoreSize);
    int Size = scoreSize;
    int pos = 0;
    while(scoreSize-- != 0)
    {
        int count = 0;
        for(int i = 0;i < Size;i++)
            if(score[pos] > score[i])
                count++;
        char *str = malloc(sizeof(char)*16);
        if(Size - count > 3)
        {
            sprintf(str,"%d",Size - count);
        }
        else if(Size - count == 3)
            strcpy(str,"Bronze Medal");
        else if(Size - count == 2 )
            strcpy(str,"Silver Medal");
        else if(Size - count == 1)
            strcpy(str,"Gold Medal");
        ptr[pos++] = str;
    }
    *returnSize = pos;
    return ptr;
}

int main()
{
    int score[] = {8,2,6,4,3,1};
    int scoreSize = sizeof(score)/sizeof(score[0]);
    int returnSize = 0;
    char **p = findRelativeRanks(score,scoreSize,&returnSize);
    for(int i = 0;i < returnSize;i++)
        printf("%s\n",p[i]);
    return 0;
}